<?php
namespace app\daili\validate;
use think\validate;
//品牌验证器
class Editsale extends validate
{


    // 验证规则
    protected $rule = [
        'sname' => 'require|min:3|max:150|unique:sale',
        'weight' => 'regex:\d{1,10}(\.\d{1,2})?$',
        'shop_price' => ['require', 'regex' => '([1-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])'],
        'market_price' => ['require', 'regex' => '([1-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])'],

    ];
    //错误信息
    protected $message = [
        'sname.require' => '商品名称必填',
        'sname.min' => '名称长度至少3个字符',
        'sname.max' => '名称长度至多50个汉字',
        'sname.unique' => '商品名称重复',
        'weight.regex' => '重量格式不对',
        'shop_price.require' => '拍卖价格必填',
        'shop_price.regex' => '拍卖价格格式不对',
        'market_price.require' => '加价金额必填',
        'market_price.regex' => '加价金额必填格式不对',
    ];

}